#include<bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a[n + 10][n + 10];
	int t = 1;
	for(int i = 1; i <= n; i ++ ) {
		a[1][i] = t ++ ;
	}
	for(int i = 2; i <= n; i ++ ) {
		for(int j = 1; j <= i - 1; j ++ ) {
			a[i][j] = a[j][i - 1];
		}
		for(int j = i; j <= n; j ++ ) {
			a[i][j] = t ++ ;
		}
	}
	
	for(int i = 1; i <= n; i ++ ) {
		for(int j = 1; j <= n; j ++ ) {
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}
